package com.ellecity06.common.ktx

import android.annotation.SuppressLint
import android.app.Activity
import android.content.Context
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.view.View
import androidx.fragment.app.Fragment
import com.gyf.immersionbar.ktx.statusBarHeight


/**
 * @author ellecity06
 * @time 2024/10/23 10:45
 * @des
 */

fun Activity.statusBar(v: View) {
    val layoutParams = v.layoutParams
    layoutParams.height = statusBarHeight
    v.layoutParams = layoutParams
}

fun Fragment.statusBar(v: View) {
    val layoutParams = v.layoutParams
    layoutParams.height = statusBarHeight
    v.layoutParams = layoutParams
}
@SuppressLint("QueryPermissionsNeeded")
fun Context.isInstallApp(packagePane: String ): Boolean {
    return if (packageName == null || "" == packageName) false else try {
        val info: ApplicationInfo = packageManager.getApplicationInfo(packageName, PackageManager.GET_UNINSTALLED_PACKAGES)
        true
    } catch (e: PackageManager.NameNotFoundException) {
        false
    }
}